# 字典

map = {1: "java", 2: "python", 3: "hadoop", 4: "hive"}

# 通过key获取value
print(map.get(1))
print(map[1])

# 修改值
map[1] = "spark"
print(map)

# 遍历
for (k, v) in map.items():
    print(k, v, sep="\t")

for k in map.keys():
    print(k, map[k], sep="\t")

ks = [1, 2, 3, 4]
vs = ["a", "b", "c", "d"]

# zip  两个列表一一对应主成一个元祖  两个列表长度要一致
for (k, v) in zip(ks, vs):
    print(k, v, sep="\t")

map = {1: "java", 2: "python", 3: "hadoop", 4: "hive"}

# 判断是否包含
print(5 in map)
print(map.keys())
print(map.values())

print(map.pop(2))
print(map)
# 通过key删除元素
del map[3]
print(map)
